#include "stdafx.h"
#include "Quad.h"

Graphic_Quad :: Graphic_Quad(float Width, float Height, Vector2D Position, DWORD COLOR)
: vecPosition(Position), vecSize(Width, Height)
{

	QuadPiece.v[0].x =	Position.x; 
	QuadPiece.v[0].y =	Position.y; 
	QuadPiece.v[1].x =	Position.x + Width; 
	QuadPiece.v[1].y =	Position.y; 
	QuadPiece.v[2].x =	Position.x + Width;  
	QuadPiece.v[2].y =	Position.y - Height; 
	QuadPiece.v[3].x =	Position.x;  
	QuadPiece.v[3].y =	Position.y - Height; 

	QuadPiece.v[0].z = 0.1f; 
	QuadPiece.v[1].z = 0.1f; 
	QuadPiece.v[2].z = 0.1f; 
	QuadPiece.v[3].z = 0.1f; 
	QuadPiece.v[0].col = COLOR; 
	QuadPiece.v[1].col = COLOR;
	QuadPiece.v[2].col = COLOR;
	QuadPiece.v[3].col = COLOR;

	QuadPiece.blend = BLEND_DEFAULT;
	QuadPiece.tex = 0;
}

Graphic_Quad :: ~Graphic_Quad()
{

}

void Graphic_Quad :: ChangeValue(const Vector2D & Position, const float & Width, const float & Height)
{
	vecSize.x = Width;
	vecSize.y = Height;
	vecPosition = Position;

	QuadPiece.v[0].x =	Position.x; 
	QuadPiece.v[0].y =	Position.y; 
	QuadPiece.v[1].x =	Position.x + Width; 
	QuadPiece.v[1].y =	Position.y; 
	QuadPiece.v[2].x =	Position.x + Width;  
	QuadPiece.v[2].y =	Position.y - Height; 
	QuadPiece.v[3].x =	Position.x;  
	QuadPiece.v[3].y =	Position.y - Height; 
}

void Graphic_Quad :: ChangeValue(const float & Width, const float & Height)
{
	vecSize.x = Width;
	vecSize.y = Height;
	QuadPiece.v[1].x =	QuadPiece.v[0].x + Width; 
	QuadPiece.v[2].x =	QuadPiece.v[0].x + Width;  
	QuadPiece.v[2].y =	QuadPiece.v[0].y - Height;  
	QuadPiece.v[3].y =	QuadPiece.v[0].y - Height; 
}

void Graphic_Quad :: ChangeValue(const Vector2D & Position)
{
	vecPosition = Position;

	QuadPiece.v[0].x =	Position.x; 
	QuadPiece.v[0].y =	Position.y; 
	QuadPiece.v[1].x =	Position.x + vecSize.x; 
	QuadPiece.v[1].y =	Position.y; 
	QuadPiece.v[2].x =	Position.x + vecSize.x;  
	QuadPiece.v[2].y =	Position.y - vecSize.y; 
	QuadPiece.v[3].x =	Position.x;  
	QuadPiece.v[3].y =	Position.y - vecSize.y; 
}

void Graphic_Quad :: ChangeValue(const DWORD & COLOR)
{
	QuadPiece.v[0].col = COLOR; 
	QuadPiece.v[1].col = COLOR;
	QuadPiece.v[2].col = COLOR;
	QuadPiece.v[3].col = COLOR;
}